<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('待受理来信')"/>
    <link th:href="@{/css/iconfont/iconfont.css}" rel="stylesheet">
    <link rel="stylesheet" type="text/css" th:href="@{/ajax/libs/qxEasyUI/themes/default/easyui.css}">
</head>
<style>
    label {
        font-weight: bold;
    }
    @font-face {
        font-family: 'huawen';
        src: url("/fonts/huawen.woff2");
    }
</style>
<body style="background-color: #F4F6FA;letter-spacing:2px;font-family:'huawen' ;font-weight: bold">
<div class="main-content" style="margin: 0;padding: 0;">
    <form id="telInputForm" th:object="${mmailGetDeal}" class="form-horizontal" style="background-color: #F4F6FA">
        <input id="pkId" name="pkId" th:field="*{pkId}" type="hidden">
        <input id="wsCode" name="wsCode" th:field="*{wsCode}" type="hidden">
        <input id="wsKey" name="wsKey" th:field="*{wsKey}" type="hidden">
        <input id="flagInt" name="flagInt" type="hidden" th:field="*{flagInt}"/>
        <input id="spareInt" name="spareInt" type="hidden" th:field="*{spareInt}"/>
        <input id="sex" name="fromSex" type="hidden" th:field="*{fromSex}"/>
        <input id="txtAutoOpen" name="autoGetFlag" type="hidden" th:field="*{autoGetFlag}"/>
        <input id="fkint" name="fkint" type="hidden" th:field="*{fkint}"/>
        <input type="hidden" id="ySpare" name="ySpare" th:value="*{yspare}" />
        <div class="col-sm-12 grid-container" style="display: flex">
            <!--     左       -->
            <div class="col-sm-8 entering-page">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-sm-2 control-label is-required entering-pd">信件来源：</label>
                        <div class="col-sm-3">
                            <input name="fromTopic" th:field="*{spareString}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <!--事发地址-->
                <div class="col-sm-12 entering-mt">
                    <div class="form-group">
                        <label class="col-sm-2 control-label is-required entering-pd">地区地址：</label>
                        <div class="col-sm-8">
                            <select name="fmAreaNo" th:field="*{fmAreaNo}" id="fmAreaNo"
                                    onchange="dropChgSendTextOnly(this,'fmAreaName');"
                                    th:with="district=${@commonServiceImpl.findArea()}" class="form-control formSelect"
                                    style="width: 120px;float:left;margin-right: 3px;"
                                    required>
                                <option value="">--请选择--</option>
                                <option th:each="item : ${district}" th:text="${item['CSText']}"
                                        th:value="${item['CSValue']}"></option>
                            </select>
                            <input type="hidden" id="fmAreaName" name="fmAreaName" th:value="*{fmAreaName}"/>
                            <input name="fmAddress" th:field="*{fmAddress}" placeholder="请输入"
                                   class="form-control scene theAddress" type="text"
                                   maxlength="100" style="width: 200px;float:left;">
                        </div>
                    </div>
                </div>

                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-sm-2 control-label is-required entering-pd">主题：</label>
                        <div class="col-sm-8">
                            <input name="fromTopic" th:field="*{fromTopic}" placeholder="请输入"
                                   class="form-control scene theAddress" type="text"
                                   maxlength="30"
                                   required="">
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label is-required entering-pd">内容：</label>
                        <div class="col-xs-10">
                            <textarea name="fmContent" id="fmContent" th:field="*{fmContent}" maxlength="4000"
                                      class="form-control phoneRemark" rows="3"
                                      style="height: 100px" required></textarea>
                            <span>还可以输入<i class="phoneRemarkI">4000</i>个文字</span>

                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required entering-pd">来信人：</label>
                            <div class="col-sm-8">
                                <input name="fromName" th:field="*{fromName}" placeholder="请输入"
                                       class="form-control phoneName" type="text" required="">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required entering-pd">联系电话：</label>
                            <div class="col-sm-8">
                                <input name="fromTel" th:field="*{fromTel}" placeholder="请输入"
                                       class="form-control relationPhone"
                                       type="text"
                                       maxlength="11" required="">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required entering-pd">来信类别：</label>
                            <div class="col-sm-8">
                                <select name="dfmClaNo" id="dfmClaNo" required
                                        th:with="telTypes=${@commonServiceImpl.findTelType()}"
                                        onchange="dropChgSendTextOnly(this,'dfmClaName');"
                                        class="form-control formSelect">
                                    <option value="">--请选择--</option>
                                    <th:block th:each="item : ${telTypes}">
                                        <option th:text="${item['CSText']}" th:value="${item['CSValue']}"
                                                th:selected="${item['CSValue'] eq mmailGetDeal.dfmClaNo}"></option>
                                    </th:block>
                                </select>
                                <input type="hidden" name="dfmClaName" id="dfmClaName" th:value="*{dfmClaName}"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required entering-pd">内容类别：</label>
                            <div class="col-sm-8">
                                <input id="qxCT" th:value="*{dCntAName}"
                                       style="width:225px;height:31px;border-radius: 5px;">
                                <input id="txtDcntAcode" name="dCntACode" type="hidden" th:value="*{dCntACode}"/>
                                <input id="txtDCntAName" name="dCntAName" type="hidden" th:value="*{dCntAName}"/>
                            </div>
                        </div>
                    </div>
                </div>
                <!--关键词等-->
                <div class="col-sm-6">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">建议公开：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="openX" th:checked="${mmailGetDeal.openX==5}" class="hideTel1"
                                           th:field="*{openX}" value="5" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="openX" th:checked="${mmailGetDeal.openX!=5}" class="hideTel2"
                                           value="0" type="radio">否
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">同意公开：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="openFrom" th:checked="${mmailGetDeal.openFrom==1}" th:field="*{openFrom}"
                                           value="1" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="openFrom" value="0" th:checked="${mmailGetDeal.openFrom==0}"
                                           type="radio">否
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">重复来信：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="repeatFlag" value="1" th:checked="${mmailGetDeal.repeatFlag==1}"
                                           th:field="*{repeatFlag}" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="repeatFlag" value="0" type="radio"
                                           th:checked="${mmailGetDeal.repeatFlag==0}">否
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">性别：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="fromSex" value="1" th:checked="${mmailGetDeal.fromSex=='1'}"
                                           th:field="*{fromSex}" type="radio">男
                                </label>
                                <label class="check-box">
                                    <input name="fromSex" value="0" type="radio"
                                           th:checked="${mmailGetDeal.fromSex=='0'}" checked>女
                                </label>
                            </div>
                        </div>
                    </div>

                </div>
                <!--交办意见-->
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label entering-pd">处理意见：</label>
                        <div class="col-xs-10">
                            <div>
                                <div class="col-xs-5">
                                    <select style="margin-left: -14px;" id="xDealDescSelect" onchange="OftenMailWordsChg(this,'xdealDesc');"
                                            th:with="district=${@commonServiceImpl.findOpinionM()}"
                                            class="form-control formSelect">
                                        <option value="">--请选择--</option>
                                        <option th:each="item : ${district}" th:text="${item['CSText']}"
                                                th:value="${item['CSValue']}" th:data="${item['Remark']}"></option>
                                    </select>
                                </div>
                                <a class="btn btn-success btn-sm" th:if="*{yspare !=null && #strings.length(yspare) >10}" onclick="lookImage(this)" style="margin: 5px;">查看图片</a>
                            </div>

                            <textarea name="xdealDesc" th:field="*{xdealDesc}" id="xdealDesc" maxlength="3500"
                                      class="form-control opinion"
                                      rows="3"></textarea>
                            <span>还可以输入<i class="opinionI">3500</i>个文字</span>
                        </div>
                    </div>
                </div>
            </div>

            <!--右-->
            <div class="col-sm-4 ">
                <!--  接听人     接通时间       挂断时间等  -->
                <div class="col-sm-12 entering-page">
                    <!--左-->
                    <div class="col-sm-12" style="padding: 5px">
                        <div class="form-group" style="margin: 0">
                            <label class="col-sm-3 control-label  entering-pd" style="font-weight: bold">来信人：</label>
                            <div class="col-sm-8">
                                <span style="margin-top: 7px; display: inline-block">[[*{fromName}]]</span>
                            </div>
                        </div>
                        <div class="form-group" style="margin: 0">
                            <label class="col-sm-3 control-label  entering-pd" style="font-weight: bold">流水号：</label>
                            <div class="col-sm-8">
                                <span style="margin-top: 7px; display: inline-block">[[*{wsCode}]]</span>
                            </div>
                        </div>
                        <div class="form-group" style="margin: 0">
                            <label class="col-sm-3 control-label  entering-pd" style="font-weight: bold">提取码：</label>
                            <div class="col-sm-8">
                                <span style="margin-top: 7px; display: inline-block">[[*{wsKey}]]</span>
                            </div>
                        </div>
                        <div class="form-group" style="margin: 0">
                            <label class="col-sm-3 control-label  entering-pd" style="font-weight: bold">联系电话：</label>
                            <div class="col-sm-8">
                                <span style="margin-top: 7px; display: inline-block">[[*{fromTel}]]</span>
                            </div>
                        </div>
                        <div class="form-group" style="margin: 0">
                            <label class="col-sm-3 control-label  entering-pd" style="font-weight: bold">来信时间：</label>
                            <div class="col-sm-8">
                                <span style="margin-top: 7px; display: inline-block" id="hangup" th:text="*{#calendars.format(fromTime,'yyyy-MM-dd HH:mm:ss')}"></span>
                            </div>
                        </div>
                        <div class="form-group" style="margin: 0">
                            <label class="col-sm-3 control-label  entering-pd" style="font-weight: bold">电子邮件：</label>
                            <div class="col-sm-8">
                                <span style="margin-top: 7px; display: inline-block">[[*{fmEmail}]]</span>
                            </div>
                        </div> 
                    </div>
                </div>
            </div>

        </div>
        <div class="col-sm-12">
            <!-- 按钮-->
            <div class="col-sm-12"
                 style="margin-bottom: 25px;display: flex;justify-content: center;flex-direction: row;">
<!--                <button type="button" class="btn btn-sm btn-warning" onclick="draft('退回坐席','121')">退回坐席-->
<!--                </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
                <button type="button" class="btn btn-sm btn-primary" onclick="temStorage('值班长暂存','141')">暂存
                </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="button" class="btn btn-sm btn-info" onclick="draft('值班长解答','166')">回信解答
                </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="button" class="btn btn-sm btn-success" onclick="draft('无效来信 当场作废','162')">作废
                </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="button" class="btn btn-sm btn-info" onclick="createWorkorder()">创建工单
                </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="button" class="btn btn-sm btn-warning" onclick="gclose()">关闭
                </button>&nbsp;
                <input id="tbStateDesc" name="stateDesc" value="草稿" type="hidden"/>
                <input id="stateFlag" name="stateFlag" value="101" type="hidden"/>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<script th:src="@{/ajax/libs/qxEasyUI/jquery.easyui.min.js}"></script>
<script>
    var prefix = ctx + "system/wsMail";

    //    存草稿
    function draft(fpStr, str) {
        $("#tbStateDesc").val(fpStr);
        $('#stateFlag').val(str);
        if ($.validate.form()) {
            let data = $('#telInputForm').serializeArray();
            $.operate.saveTab(prefix + "/edit", data);
        }
    }
    // 暂存
    function temStorage(fpStr, str) {
        $("#tbStateDesc").val(fpStr);
        $('#stateFlag').val(str);
        if ($.validate.form()) {
            let data = $('#telInputForm').serializeArray();
            var config = {
                url: prefix + "/edit",
                type: "post",
                dataType: "json",
                data: data,
                success: function(result) {
                    $.modal.msgSuccess('操作成功');
                }
            };
            $.ajax(config);
        }
    }

    function createWorkorder() {
        var flag = $.validate.form();
        if ($("#txtDcntAcode").val() == '') {
            $('.combo-text').addClass('error');
            flag = false;
        } else {
            $('.combo-text').removeClass('error');
        }
        if (flag) {
            if ($('#fmContent').val()==''){
                return $.modal.alertWarning('温馨提示:请输入来信内容');
            }
            let data = $('#telInputForm').serializeArray();
            var config = {
                url: prefix + '/createWorkform',
                type: "post",
                dataType: "json",
                data: data,
                success: function (result) {
                    $.operate.ajaxTabSuccess(result);
                    // $.operate.successTabCallback(result);
                    // parent.$.modal.msgSuccess('操作成功');
                    // $.modal.msgSuccess('操作成功');
                    // debugger
                    // refreshNotAcceptList();
                    var url = prefix + '/tworkform/' + result.pkId;
                    $.modal.parentTab('拟派工单', url);
                }
            };
            $.ajax(config);
        }
    }

    $('#qxCT').combotree({
        url: '/system/common/findContentCate',
        required: false,
        onSelect: function (record) {
            $("#txtDcntAcode").val(record.id);
            $("#txtDCntAName").val(record.text);
            $('.combo-text').removeClass('error');
        }
    });

    //    关闭
    function gclose() {
        $.modal.closeTab();
    }


    function OftenMailWordsChg(e,acpId) {
        temp = $(e.options[e.selectedIndex]).attr('data');
        document.getElementById(acpId).value = temp;
    }

    // 刷新待受理信件列表页
    function refreshNotAcceptList() {
        var navFrame = $('.NAP_iframe[data-id="/system/wsMail/wait"]', parent.document)[0];
        navFrame.contentWindow.$.table.refresh();
    }
</script>
</body>
</html>

